<?php
/**
 * Dao of Comment
 *
 * @author fsqijy
 */


require_once BaseUtil::getModulePath("base") . '/models/BaseDao.php';

class CommentReplyDao extends BaseDao{

    protected $_name;

    public function  _setup() {
        $this->_name = $this->prefix() . "comment_replies";
        parent::_setup();
    }
    
    public function saveReply($param){
    	$select = $this->db_r->select();
    	$select->from('comment_replies','id');
    	$select->where('comment_id=?',$param['comment_id']);
    	$commentReply = $this->db_r->fetchRow($select->__toString());
    	if( !empty($commentReply) ){
	        $where = $this->db_w->quoteInto('comment_id = ?', $param['comment_id']);
	        $param['modified'] = date('Y-m-d H:i:s');
	        return $this->update($param,$where);
    	}else{
    		return $this->insertData($param);
    	}
        return false;
    }
    
}
